
public class BreadthFirstSearchTest {
    public static void main(String[] args) {
        Graph graph = new Graph(13);
        graph.addEdge(0,5);
        graph.addEdge(0,1);
        graph.addEdge(0,2);
        graph.addEdge(0,6);
        graph.addEdge(5,3);
        graph.addEdge(5,4);
        graph.addEdge(3,4);
        graph.addEdge(4,6);
        graph.addEdge(7,8);
        graph.addEdge(9,11);
        graph.addEdge(9,12);
        graph.addEdge(9,10);
        graph.addEdge(11,12);

        // 对图进行广度优先搜索
        BreadthFirstTraversal breadthFirstTraversal = new BreadthFirstTraversal(graph,0);

        // 判断 某个顶点是否和 顶点0连通
        System.out.println(breadthFirstTraversal.marked(5));
        System.out.println(breadthFirstTraversal.marked(3));
        System.out.println(breadthFirstTraversal.marked(7));
        //  获取与顶点 apex 相通的所有顶点的总数
        System.out.println(breadthFirstTraversal.getCount());
    }
}
